
<article class="cl pd-20" >
    <form  class="form form-horizontal" id="form-role-add">
        <div class="row cl">
            <label class="form-label col-xs-3 " style="text-align: center;"><span class="c-red">*</span>角色名：</label>
            <div class="formControls col-xs-7 ">
                <input type="text" class="input-text" value="" placeholder="" id="name" name="name" />
            </div>
        </div>
        <!--<div class="row cl">-->
            <!--<label class="form-label col-xs-3 " style="text-align: center;"><span class="c-red">*</span>关联权限：</label>-->
            <!--<div class="formControls col-xs-7 ">-->
                <!--<input type ="hidden" name="permissionList" id="pids"/>-->
                <!--<input type="text" class="input-text" value="" placeholder="" onclick="showMenu();" id="permissionList"  />-->
            <!--</div>-->
        <!--</div>-->

        <div class="row cl">
            <div class="col-xs-8 col-xs-offset-3">
                <input class="btn btn-primary radius" id="submit" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" />
            </div>
        </div>



    </form>
</article>
<div id="menuContent" class="menuContent" style="display:none; position: absolute;background-color: #f0f6e4;z-index: 99999;">
    <ul id="treeRole" class="ztree" style="margin-top:0; width:180px;"></ul>
</div>
    <link rel="stylesheet" type="text/css" th:href="@{/H-UI/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css}" />
    <script type="text/javascript" th:src="@{/H-UI/lib/jquery.validation/1.14.0/jquery.validate.js}"></script>
    <script type="text/javascript" th:src="@{/H-UI/lib/jquery.validation/1.14.0/messages_zh.js}"></script>
    <script type="text/javascript" th:src="@{/H-UI/lib/zTree/v3/js/jquery.ztree.all-3.5.js}"></script>
<script type="text/javascript" th:src="@{/scripts/role/add.js}"></script>

<script>
        $(function(){
            $("#form-role-add").validate({
                rules:{
                    name:{required:true}
                },message:{
                    name:{required:"必填"}
                }
            });

            $("#submit").on('click',function(){
                if($("#form-role-add").valid()){

                    $.ajax({
                        url:"/role/save",
                        type:"post",
                        dataType:'json',
                        data:$("#form-role-add").serialize(),
                        success:function(data){

                            if(data.message =="200"){
                             var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                             parent.location.replace(parent.location.href);
                             parent.layer.close(index);
                             }
                        }
                    });

                }
            });



        });

    </script>

